﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class SetPrices : System.Web.UI.Page
{
    Connectdbnour con = new Connectdbnour();
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        String[] array = new String[3];
        if (DropDownList3.SelectedItem.ToString() == "Powers")
        {
            array = con.Showpricelenspowers(DropDownList1.SelectedItem.ToString(), DropDownList2.SelectedItem.ToString());
        }
        else if (DropDownList3.SelectedItem.ToString() == "Plano")
        {
            array = con.Showpricelensplano(DropDownList1.SelectedItem.ToString(), DropDownList2.SelectedItem.ToString());
        }
        Label1.Text = array[0];
        TextBox1.Text = array[1];
        TextBox2.Text = array[2];
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        String[] array = new String[3];
        if (DropDownList5.SelectedItem.ToString() == "Powers")
        {
            array = con.Showpriceboxpowers(DropDownList4.SelectedItem.ToString(), Convert.ToInt16(DropDownList10.SelectedItem.ToString()), DropDownList6.SelectedItem.ToString());
        }
        else if (DropDownList5.SelectedItem.ToString() == "Plano")
        {
            array = con.Showpriceboxplano(DropDownList4.SelectedItem.ToString(), Convert.ToInt16(DropDownList10.SelectedItem.ToString()), DropDownList6.SelectedItem.ToString());
        }
        Label2.Text = array[0];
        TextBox3.Text = array[1];
        TextBox4.Text = array[2];
    }
    protected void Button5_Click(object sender, EventArgs e)
    {
        String[] array = new String[3];
        array = con.Showpricesoln(DropDownList7.SelectedItem.ToString(),Convert.ToInt16(DropDownList8.SelectedItem.ToString()));
        Label3.Text = array[0];
        TextBox5.Text = array[1];
        TextBox6.Text = array[2];
    }
    protected void Button7_Click(object sender, EventArgs e)
    {
        String[] array = new String[3];
        array = con.Showpriceaccs(DropDownList9.SelectedItem.ToString());
        Label4.Text = array[0];
        TextBox7.Text = array[1];
        TextBox8.Text = array[2];
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (DropDownList3.SelectedItem.ToString() == "Powers")
        {
            con.Updatepricelenspowers(DropDownList1.SelectedItem.ToString(), DropDownList2.SelectedItem.ToString(),Convert.ToInt16(TextBox1.Text),Convert.ToInt16(TextBox2.Text));
        }
        else if (DropDownList3.SelectedItem.ToString() == "Plano")
        {
            con.Updatepricelensplano(DropDownList1.SelectedItem.ToString(), DropDownList2.SelectedItem.ToString(), Convert.ToInt16(TextBox1.Text), Convert.ToInt16(TextBox2.Text));
        }
        Response.Redirect("Setprices.aspx");
    }
    protected void Button4_Click(object sender, EventArgs e)
    {
        if (DropDownList5.SelectedItem.ToString() == "Powers")
        {
            con.Updatepriceboxpowers(DropDownList4.SelectedItem.ToString(), Convert.ToInt16(DropDownList10.SelectedItem.ToString()), DropDownList6.SelectedItem.ToString(), Convert.ToInt16(TextBox3.Text), Convert.ToInt16(TextBox4.Text));
        }
        else if (DropDownList5.SelectedItem.ToString() == "Plano")
        {
            con.Updatepriceboxplano(DropDownList4.SelectedItem.ToString(), Convert.ToInt16(DropDownList10.SelectedItem.ToString()), DropDownList6.SelectedItem.ToString(), Convert.ToInt16(TextBox3.Text), Convert.ToInt16(TextBox4.Text));
        }
    }
    protected void Button6_Click(object sender, EventArgs e)
    {
        con.Updatepricesoln(DropDownList7.SelectedItem.ToString(), Convert.ToInt16(DropDownList8.SelectedItem.ToString()), Convert.ToInt16(TextBox5.Text), Convert.ToInt16(TextBox6.Text));
    }
    protected void Button8_Click(object sender, EventArgs e)
    {
        con.Updatepriceaccs(DropDownList9.SelectedItem.ToString(), Convert.ToInt16(TextBox7.Text), Convert.ToInt16(TextBox8.Text));
    }
}